package com.rightsidetech.http.controller.userApp.system;

import com.rightsidetech.system.service.SystemParamService;
import io.swagger.annotations.Api;
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.apache.shenyu.client.springmvc.annotation.ShenyuSpringMvcClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;

@RestController
@RequestMapping("/userApp/systemParam")
@ShenyuSpringMvcClient(path = "/userApp/systemParam/**")
@Api(tags = "后台系统参数")
public class AppSystemParamController {

    @Resource
    private SystemParamService systemParamService;

/*    @GetMapping("/get")
    @ApiOperation("获取门店的上班时间")
    public ResponseData<String> getWordTime(){
        return systemParamService.getWorkTime();
    }*/


    public static void main(String[] args) throws UnsupportedEncodingException {
        System.out.println("测测试2");


        DefaultMQProducer producer = new DefaultMQProducer("cwProducerGroup");
        producer.setNamesrvAddr("192.168.1.189:9876");
        producer.setSendMsgTimeout(6000);
        try {
            producer.start();
        } catch (MQClientException e) {
            e.printStackTrace();
        }

        Message msg = new Message("cworderTopic","tag002","11111".getBytes(StandardCharsets.UTF_8));
        msg.setDelayTimeLevel(2);//30分钟延时消息
        try {
            SendResult sendResult = producer.send(msg);
        } catch (MQClientException e) {
            e.printStackTrace();
        } catch (RemotingException e) {
            e.printStackTrace();
        } catch (MQBrokerException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
